# -*- coding: utf-8 -*-
# @Time : 2022/4/6 21:59
# @Author : Liuqing
# @File : 剑指Offer39)数组中出现次数超过一半的数字.py
# @Software : PyCharm
import collections
from typing import List


class Solution:
    def majorityElement(self, nums: List[int]) -> int:
        counts = collections.Counter(nums)
        return max(counts.keys(), key=counts.get)
